/*
 * Copyright (c) 2024-2025 LTC-CN. All rights reserved.
 * <p>
 * This file is part of the ltc-cn-springboot project.
 * <p>
 * ltc-cn-springboot is distributed under the terms of the MIT License.
 * For details, see the accompanying LICENSE file or visit:
 * <a href="https://www.ltc-cn.top/projects">...</a>
 */

package top.ltc_cn.minecraft_manager.entity.minecraft;

import jakarta.persistence.*;
import jakarta.validation.constraints.*;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
@Entity
@Table(name = "player_auth")
public class PlayerAuth {

    @Id
    @Column(nullable = false, unique = true)
    private Long id;

    @OneToOne
    @MapsId // 共享主键
    @JoinColumn(name = "id") // 外键与主键同名
    private PlayerInfo playerInfo;

    @Column(nullable = false) // 密码不能为空
    //@Pattern(regexp = "", message = "密码必须包含数字、字母及特殊符号，并且长度在8到20个字符之间！")
    @Size(min = 1, max = 255, message = "密码长度不合规!")
    private String password;

    @Size(max = 255, message = "密码盐长度不合规!")
    private String passwordSalt;

    // 注册地的ip
    @Column(nullable = false)
    @NotNull(message = "注册地IP不能为空")
    private String registerIp;

//    @Column(nullable = false, unique = true)
//    @Size(min = 1, max = 255, message = "密码盐长度不合规!")
//    private String passwordSalt;

}
